<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <button @click="roll">浪你个浪</button>
        <button @click="stop">给我停</button>

        <p>{{msg}}</p>
    </div>
    <script>
        new Vue({
            el : '#app',
            data : {
                msg : '让你浪,给我停',
                timeId : null
            },
            methods : {
                roll(){
                    clearInterval(this.timeId)
                    this.timeId = setInterval(()=>{
                        let start = this.msg.substr(0,1)
                        let end = this.msg.substr(1)
                        this.msg = end + start
                        this.test()
                    },300)
                },
                stop(){
                    clearInterval(this.timeId)
                },
                test(){
                    console.log('在不停信不信我抽你');
                    
                }
            }
        })
    
    </script>
</body>
</html>